package cn.bgs.controller;

import cn.bgs.service.ComplaintService;
import cn.bgs.utils.R;
import cn.bgs.vo.Pagevo;
import cn.bgs.vo.TopUpvo;
import cn.bgs.vo.testVo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/controllerll")
public class ComplaintController {
    @Autowired
    ComplaintService complaintService;
    //投诉类型表  分页+全查+模糊查
    @PostMapping("compill")
    public PageInfo<testVo> selectCompAll(@RequestBody Pagevo pagevo){
        PageInfo<testVo> page=complaintService.page3(pagevo);
        return page;
    }
    //投诉类型表  删除
    @DeleteMapping("/{complaintsTypeId}")
    public R delComptAll(@PathVariable Integer complaintsTypeId){
        complaintService.delCompAll(complaintsTypeId);
        if(complaintsTypeId!=null){
            return R.ok().data("删除成功",complaintsTypeId);
        }else{
            return R.error();
        }
    }
    @PostMapping("/updatec")
    public R update(@RequestBody testVo form){
        complaintService.updateComptAll(form);
        if (form!=null){
            return  R.ok();
        }else{
            return R.error();
        }

    }
    @PostMapping("/insertcom")
    public R insertComptAll(@RequestBody testVo insertaa){
        complaintService.insertComptAll(insertaa);
        if (insertaa!=null){
          return R.ok();
        }else{
           return R.error();
        }
    }

}
